function doCategoryBox(data)
{
    addHtml(document.getElementById('categoryBox'), 'beforeend', 'categoryBoxTemplate', data, doCategoryContent);
}

function doCategoryContent(data)
{
    var list = data['list'];
    categoryTotal = list.length;
    for(var i = 0; i < list.length; i++){
        (function(id){
            requestUrl('GET', 'http://116.62.156.219:13000/api/video/getList?category=' + id, function(data){
                addHtml(document.getElementById('contentBox' + id), 'beforeend', 'contentBoxTemplate', data.data, doCategoryContentFinish);
            }, false);
        })(list[i]['id']);
    }
}

function doCategoryContentFinish(data)
{
    categoryLoaded++;
    if(categoryLoaded == categoryTotal){
        var list = [
            "js/mui.min.js",
            "js/mui.pullToRefresh.js",
            "js/mui.pullToRefresh.material.js"
        ];
        loadJsSort(list, 0, useMui);
    }
    else{
        console.log(categoryLoaded + "/" + categoryTotal);
    }
}
